package cn.iocoder.yudao.module.wms.dal.mysql.driver;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.wms.dal.dataobject.driver.DriverDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.wms.controller.admin.driver.vo.*;

/**
 * 驾驶员资料 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface DriverMapper extends BaseMapperX<DriverDO> {

    default PageResult<DriverDO> selectPage(DriverPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DriverDO>()
                .eqIfPresent(DriverDO::getAddress, reqVO.getAddress())
                .eqIfPresent(DriverDO::getCreateAt, reqVO.getCreateAt())
                .eqIfPresent(DriverDO::getDriving, reqVO.getDriving())
                .eqIfPresent(DriverDO::getGender, reqVO.getGender())
                .eqIfPresent(DriverDO::getIdCard, reqVO.getIdCard())
                .eqIfPresent(DriverDO::getLicense, reqVO.getLicense())
                .likeIfPresent(DriverDO::getName, reqVO.getName())
                .eqIfPresent(DriverDO::getPhone, reqVO.getPhone())
                .eqIfPresent(DriverDO::getScore, reqVO.getScore())
                .eqIfPresent(DriverDO::getUpdateAt, reqVO.getUpdateAt())
                .orderByDesc(DriverDO::getUpdateAt));
    }

}